<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    <title>prototype</title>
</head>

<body>
    <h4>prototype</h4>
</body>
<script type="text/javascript">
    function employee(name, job, born) {
        this.name = name;
        this.job = job;
        this.born = born;
    }

    var bill = new employee("Bill Gates", "Engineer", 1985);

    employee.prototype.salary = 40;
    bill.salary = 20000;

    document.write(bill.salary);
    console.log(bill.salary);

    var tip = function (a, b) {
        this.a = a;
        this.b = b;

    }
    tip.prototype.addt = function () {
        console.log("a = "+this.a);
        return (this.a + this.b);
    }
    tip.prototype.cos = 10;
    var obj1 = new tip(1, 2);
    var obj2 = new tip(2, 3);
    var r1 = obj1.addt();
    console.log(obj1.cos);
    console.log(r1);
    // console.log(obj2.addt);
</script>

</html>